package com.guigu.www.web;

import com.guigu.www.Service.ClassService;
import com.guigu.www.pojo.Class;
import com.guigu.www.pojo.PageVo;
import com.guigu.www.pojo.Zy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("cla")
@CrossOrigin
public class ClassController {
    @Autowired
    ClassService service;
    @PostMapping
    public PageVo<Class> findClassPage(@RequestBody Map<String,String> map){
        return service.findClassPage(map);
    }

    @GetMapping
    public List<Zy> findzy(){
        return service.findZy();
    }
    @PutMapping
    public void updateStu(@RequestBody Class stu){
        service.updateByPrimaryKey(stu);
    }
    @PostMapping("/insert")
    public void insertStu(@RequestBody Class stu){
        service.insert(stu);
    }
    @DeleteMapping("{cid}")
    public void deleteStu(@PathVariable("cid") Integer cid){
        service.deleteByPrimaryKey(cid);
    }
}
